package com.ll.datedemo;

import java.util.Calendar;

/**
 * @author 刘龙
 * @version 1.0
 */
public class Calendar01 {
    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        // 2021
        System.out.println(calendar.get(Calendar.YEAR));


        // 默认从0开始
        // 3
        System.out.println(calendar.get(Calendar.MONTH) + 1);

        // 日 24
        System.out.println(calendar.get(Calendar.DAY_OF_MONTH));

        // 时 10
        System.out.println(calendar.get(Calendar.HOUR));

        // 分钟 50
        System.out.println(calendar.get(Calendar.MINUTE));

        // 秒 39
        System.out.println(calendar.get(Calendar.SECOND));
    }
}
